fft = require('./hard_fft.js')
toWord = require( 'math-float32-to-word' )
fromWord = require( 'math-float32-from-word' )
_ = require 'lodash'
fs = require "fs"
v=[
  0x00000000
  0x00000000
  0xb3d80000
  0xb46e0000
  0xb4d80000
  0xb52b0000
  0xb5520000
  0xb5640000
  0xb4af0000
  0x34dc8000
  0x35e04000
  0x3649e000
  0x36945000
  0x36bb0800
  0x36d3c000
  0x36f36000
  0x36e86800
  0x36dbe800
  0x36d72800
  0x36b18000
  0x369d0000
  0x36a23000
  0x36b22000
  0x36e97000
  0x37145000
  0x373fcc00
  0x37848000
  0x37b2c000
  0x37c4fe00
  0x37be7e00
  0x37c64800
  0x37cda000
  0x37b57a00
  0x37625000
  0x36fe4000
  0x35ef4000
  0xb63dc000
  0xb6c87000
  0xb6d32000
  0xb6944000
  0xb669d000
  0xb6a3a000
  0xb62ba000
  0xb686d000
  0x36bc0000
  0xb6f5c800
  0xb7004800
  0xb5d62000
  0xb70b7400
  0xb6ae4800
  0xb6b55000
  0xb5fb6000
  0x36029000
  0x37078000
  0x37e45000
  0x38483c00
  0x38752c00
  0x38926d00
  0x38b0b580
  0x38ac3800
  0x389c6280
  0x38801280
  0x3837e000
  0x37bdb000
  0x36439000
  0xb77be000
  0xb7cf8000
  0xb7a03800
  0xb85bd000
  0xb8621000
  0xb81fc200
  0xb8420900
  0xb8755000
  0xb885cf00
  0xb8a9a400
  0xb8dfce00
  0xb903c000
  0xb8fcbb00
  0xb8bb9080
  0xb89b8e80
  0xb88c9100
  0xb8664c00
  0xb8580c00
  0xb7f12000
  0xb7247000
  0x36a82800
  0x00000000
  0x00000000
  0xb6b37800
  0xb6b75000
  0x378c6400
  0x378f4c00
  0x00000000
  0xb746f800
  0xb8319900
  0xb8816000
  0xb8e03880
  0xb90d2d00
  0xb9090300
  0xb904a100
  0xb8b8de80
  0xb89f4e80
  0xb86bf000
  0xb8871b00
  0xb8375a00
  0xb81b7800
  0xb88e5d80
  0xb890cf00
  0xb92bd080
  0xb947aa00
  0xb96ccc00
  0xb94e4c00
  0xb8d1a600
  0xb88e0400
  0xb87c7700
  0xb8928800
  0xb83a0400
  0xb8171c00
  0xb7196800
  0xb71bb400
  0x00000000
  0x38205c00
  0x388e5a00
  0x39061680
  0x3946c6c0
  0x39a47200
  0x39b6e200
  0x39bedc00
  0x39d20ec0
  0x39d4e580
  0x39c106c0
  0x398fd2c0
  0x399d5c00
  0x393cec00
  0x388f8500
  0x37c1cc00
  0xb7c43c00
  0xb846ac00
  0xb8fb6800
  0xb918b200
  0xb9412b40
  0xb9367380
  0xb945cc40
  0xb97d7e80
  0xb9656f00
  0xb923d100
  0xb8f88980
  0xb85f6800
  0x3761e800
  0x388ec100
  0x39105100
  0x39834a80
  0x39b84d40
  0x39d80e40
  0x39f87360
  0x3a08ef00
  0x3a216580
  0x3a230c20
  0x3a307660
  0x3a363120
  0x3a340000
  0x3a31b800
  0x3a12d240
  0x3a0c0040
  0x39cfd960
  0x39864600
  0x39296a00
  0xb788ca00
  0xb8f19180
  0xb9829560
  0xb9afac80
  0xba007f10
  0xba20eb40
  0xba2fda30
  0xba438ec0
  0xba453cc0
  0xba54c8a0
  0xba568ee0
  0xba40d400
  0xba25f5a0
  0xba05d900
  0xb9ad7840
  0xb92edbc0
  0xb8c3d200
  0xb81de000
  0x00000000
  0x38205000
  0x00000000
  0x3822be00
  0x00000000
  0xb8252800
  0xb8a65a00
  0xb93c7d80
  0xb97d1d00
  0xb994b040
  0xb98b0860
  0xb98bfdc0
  0xb9821b80
  0xb9702440
  0xb9afd000
  0xb9bc09a0
  0xb95ead00
  0xb991ac20
  0xb9d64500
  0xb9e2fb80
  0xb9cd9140
  0xb9da5540
  0xb9b8fc00
  0xb9f444c0
  0xb9de54e0
  0xb9dfa620
  0xb9eccc00
  0xb9b2a160
  0xb9a7adc0
  0xb940b800
  0xb95a07c0
  0xb95b3c00
  0xb912f580
  0xb8450200
  0x37c61000
  0x39155500
  0x39612ac0
  0x39493000
  0x38fcc380
  0x3964a380
  0x3932b640
  0x3919f000
  0x39347800
  0x390186c0
  0x38d03a00
  0x38d13200
  0x389d9f80
  0x38532000
  0x37d41400
  0x391fc480
  0x38d5f400
  0x39064d40
  0x37d7ce00
  0xb8a28880
  0xb9880180
  0xb9bf31c0
  0xb9b24140
  0xba02c860
  0xba1ef070
  0xba345e60
  0xba2e1730
  0xba04cf50
  0xb9c471c0
  0xb97d7e80
  0xb8622400
  0x3862f200
  0x39474480
  0x399d1ac0
  0x399da2e0
  0x39baeb60
  0x39c9f440
  0x3a023ec0
  0x39f6cc80
  0x39cbe1c0
  0x39bde580
  0x39928380
  0x398440e0
  0xb7ebcc00
  0xb94ee900
  0xb94f7dc0
  0xb9b25780
  0xb9ee6e00
  0xb9a459a0
  0xb8b3c100
  0xb8704800
  0xb7f0e200
  0xb8f17800
  0xb8720c00
  0xb7f29c00
  0xb7f32a00
  0xb9185080
  0xb9d5b640
  0xba2feb70
  0xba6d99e0
  0xba4f5d60
  0xba6e8e00
  0xba6f0430
  0xba584bc0
  0xba7f6120
  0xba83cbb0
  0xba70bfe0
  0xba59d040
  0xba42cb30
  0xba3b4d00
  0xb9fa1e00
  0xb99c8d80
  0x00000000
  0x395bca00
  0x399d33c0
  0x39bce380
  0x393d1e00
  0x391dc9c0
  0x393d9000
  0x37fd0600
  0x00000000
  0xb93e2780
  0xb97dc600
  0xb99ec000
  0xb8fe3800
  0x38bed100
  0x398f37c0
  0x39af2ae0
  0x3a0f6940
  0x39df3880
  0x39bf7000
  0x398fa720
  0x391fb000
  0x393fb380
  0x393fc580
  0x393fd480
  0xb7ffd800
  0xb7ffe600
  0xb93ff400
  0xb8fff800
  0xb87ffe00
  0xb97ffe00
  0xb98ffee0
  0xb99ffb00
  0xb93ff400
  0xb95fe940
  0xb8bfe200
  0x00000000
  0x38ffb200
  0x399fc040
  0x393fa000
  0x398fa720
  0x38bf7000
  0x38ff1c00
  0x397ef400
  0x395ef0c0
  0x399f2180
  0x39bed100
  0x39ee5480
  0x39ce6000
  0x3a06d130
  0x39fd8a00
  0x3a2e22e0
  0x39fd0600
  0x399df800
  0x391dc9c0
  0xb8bd1e00
  0xb91d6840
  0xb91d33c0
  0xb7fb3000
  0xb95b7d00
  0xb93bdd00
  0xb99c52c0
  0xb95a8480
  0xb95a2b40
  0xb978ee00
  0xb8788400
  0xb7f81600
  0xb7f7a400
  0xb8773200
  0xb7f6ba00
  0x38f64000
  0x39199a80
  0x38b7f300
  0x39379180
  0x398962e0
  0x39a78bc0
  0x3997fa40
  0x39e37240
  0x39f20c00
  0x3a1e76c0
  0x3a168d40
  0x3a253180
  0x3a3b3e60
  0x3a1568c0
  0x3a492cd0
  0x3a48a270
  0x3a40aba0
  0x3a13cb00
  0x3a0c0120
  0x3a0440e0
  0x39a12a40
  0x39921300
  0x38690200
  0xb7e84800
  0xb8ada900
  0xb92d1a80
  0xb8e60e00
  0xb90f4e40
  0xb8e48400
  0xb863bc00
  0x394693c0
  0x3a064560
  0x3a3009a0
  0x3a5279e0
  0x3a74a650
  0x3a6cc360
  0x3a8746c8
  0x3a8da9c8
  0x3a632620
  0x3a3ff780
  0x3a163960
  0x3a1c6820
  0x3a228880
  0x3a2f5760
  0x3a2e97a0
  0x3a207700
  0x39efa6c0
  0x39b99180
  0x399e5800
  0x39522a00
  0x39370bc0
  0x396a4140
  0x394f3e00
  0x394e4000
  0x39804800
  0x39992e80
  0x394b3c00
  0x38fcc380
  0x38c93000
  0x38482600
  0x38f8e300
  0x39461000
  0x3893c180
  0x38c3f200
  0x3942e000
  0x39724180
  0x3940b800
  0x390fb980
  0xb88ee780
  0xb8eccc00
  0xb8eb6b80
  0xb9c6eda0
  0xb9ffe680
  0xba0abd00
  0xba1562c0
  0xb9d8fce0
  0xb979ae40
  0x37b47000
  0x397685c0
  0x39bd4640
  0x39e84820
  0x39fcbb00
  0x39c47ac0
  0x39821b80
  0x39575f00
  0x382b1e00
  0xb7a9ee00
  0xb7a8be00
  0xb7a78c00
  0x38265a00
  0x00000000
  0xb7a3f200
  0xb7a2be00
  0x37a18800
  0x00000000
  0x00000000
  0x386cd000
  0x38eafc00
  0x39880040
  0x397a9140
  0x3998f800
  0x39639a00
  0x38bc2000
  0x38ba9280
  0xb7940600
  0xb892c800
  0xb85a4c00
  0x38904a00
  0x3944adc0
  0x398dca00
  0x39a6e3e0
  0x39bf85c0
  0x39cf0f00
  0x39d5bba0
  0x39d3c480
  0x39a7d780
  0x39a64780
  0x39561e80
  0x39232280
  0x38e23000
  0x39400000
  0x395dcc80
  0x391cdb00
  0x38d96580
  0x3899b600
  0xb7737000
  0xb7f0ec00
  0xb8d09b00
  0xb8ebe800
  0xb911e100
  0xb901e280
  0xb88ec100
  0xb8a96e00
  0xb75f6800
  0x00000000
  0xb75a6c00
  0xb857f000
  0xb8d57800
  0xb9110d40
  0xb988d6a0
  0xb9a769c0
  0xb9bede80
  0xb9c92000
  0xb9b40be0
  0xb9b1d660
  0xb99d75c0
  0xb96f3300
  0xb9254e80
  0xb8ba8000
  0xb80a1200
  0x3735ac00
  0x37334800
  0x00000000
  0xb7ae8000
  0xb7ac2000
  0xb729c000
  0xb7276400
  0x37a50800
  0x37f40800
  0x37205c00
  0xb8458a00
  0xb8d61780
  0xb922fe80
  0xb94654c0
  0xb95f3800
  0xb9497b00
  0xb9224c80
  0xb90523c0
  0xb80bc400
  0x00000000
  0x37875000
  0x38266300
  0x3823a200
  0x3780b800
  0x36fd1800
  0x00000000
  0xb7747800
  0xb6f03000
  0x36ebf000
  0x37e7b800
  0x37e38800
  0x38278800
  0x375b3800
  0x36d72000
  0xb79e4600
  0xb868e000
  0xb8983a00
  0xb8c6f800
  0xb8b6d000
  0xb8bf1000
  0xb8d29600
  0xb8a06600
  0xb8b37800
  0xb8a4ad80
  0xb88ba600
  0xb89da580
  0xb8c34500
  0xb8bee400
  0xb8b0c400
  0xb8acb900
  0xb815f000
  0xb6926800
  0x368ee800
  0x37ae4c00
  0x37cc0000
  0x38365c00
  0x38014000
  0x367be000
  0xb6755000
  0xb7d0f600
  0xb8113c00
  0xb837ad00
  0xb8405600
  0xb82d9200
  0xb8359000
  0xb8305000
  0xb81ee500
  0xb7d56600
  0xb7e5d800
  0xb8270d00
  0xb8422200
  0xb8701000
  0xb8725800
  0xb856c200
  0xb8040400
  0xb7fed800
  0xb803b800
  0xb8078000
  0xb7b38600
  0xb78d6600
  0xb7355000
  0xb7113c00
  0x35df2000
  0x36562000
  0x378d1c00
  0x38010900
  0x3812e000
  0x3817aa00
  0x37ebfc00
  0x37996600
  0x36c2d800
  0xb6144000
  0xb71e5800
  0xb7487000
  0xb74d9000
  0xb7604c00
  0xb6c5c000
  0x00000000
  0x36163000
  0x37014000
  0x37725800
  0x3785dc00
  0x3779d800
  0x3744a000
  0x36c6c000
  0x36197000
  0xb4e20000
  0xb54f8000
  0xb58e8000
  0x352d0000
  0xb51d0000
  0xb60e0000
  0xb60f7000
  0xb5ff6000
  0xb5e22000
  0xb5b10000
  0xb5408000
  0x35050000
  0x35620000
  0x3582a000
  0x35a5c000
  0x357c0000
  0x35228000
  0x34980000
  0x33600000
  0xb3180000
  0xb41c0000
  0xb41a0000
  0xb3960000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
  0x00000000
]

list = _.map(v,(n)=>fromWord(n))
start = fft.fft_cal(list, _.range(list.length), 0, "start", 0)

console.log("************************************")

#start = fft.fft_cor(list, _.range(list.length))
fs.writeFileSync("test_res", "", "utf8")
for addr in _.range(256)
  for idx in _.range(4)
    real = toWord(fft.buffer[idx][addr][0])
    #console.log(real.toString(16))
    fs.appendFileSync("test_res", real.toString(16)+"\n", "utf8")
    imag = toWord(fft.buffer[idx][addr][1])
    #console.log(imag.toString(16))
    fs.appendFileSync("test_res", imag.toString(16)+"\n", "utf8")
#for i in fft.fft_cor(list, _.range(list.length), 0, "start")
#  real=toWord(i[0])
#  console.log real.toString(16)
#  imag=toWord(i[1])
#  console.log imag.toString(16)
